package cn.vihub.handler;

import cn.vihub.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 郜怀达
 * @version 1.0
 * @description: 统一异常处理类
 * @date 2022/9/14 23:16
 */

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(MyRuntimeException.class)
    public Result<Boolean> error(Exception e) {
      return Result.error(e.getMessage());
    }

}
